import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../../AppConfig/Config.dart';
import '../../l10n/messages.dart';

class QueryViolations extends StatefulWidget {
  const QueryViolations({super.key});

  @override
  State<QueryViolations> createState() => _QueryViolationsState();
}

class _QueryViolationsState extends State<QueryViolations> {
  int isCheck=0;
  List titleList=["违反禁止标线指示","不按导向车道行驶"];
  @override
  Widget build(BuildContext context) {
    final screenSize = MediaQuery.of(context).size;
    var messages = AppLocalizations.of(context)!;
    return Scaffold(
      backgroundColor: MyColors.backgreyColor,
      appBar: AppBar(
        backgroundColor: Colors.white,
        centerTitle: true,
        title: Text("查询违章",style: TextStyle(color: Colors.black,fontWeight: FontWeight.w300,fontSize: 16.sp),),
      ),
      body: ListView(
        children: [
          SizedBox(height: 8.h,),
          Container(
            padding: EdgeInsets.only(left: 10.w,right: 10.w,top:10.h ),
            color: Colors.white,
            child:Column(
              children: [
                Row(
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: [
                    Image.asset("lib/Images/PersonCenter/查询违章小车icon.png",height: 50.h,width: 50.w,),
                    SizedBox(width: 8.w,),
                    Text("鲁K25Z15",style: TextStyle(color: Colors.black,fontSize: 16.sp,fontWeight: FontWeight.w600),),
                  ],
                ),
                Divider(color: MyColors.backgreyColor,),
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    SizedBox(),
                    Column(
                      children: [
                        TextButton(onPressed: (){
                          setState(() {
                            isCheck=0;
                          });
                        },
                          child:  Row(
                            children: [
                              Text("未处理",style: TextStyle (fontWeight:isCheck==0? FontWeight.w600:FontWeight.w300,color:Colors.black,fontSize: isCheck==0?14.sp:12.sp),),

                            ],
                          ),
                        ),
                        Container(height: 2.h,width: 27.w,color:isCheck==0?Color.fromRGBO(231, 112, 27, 0.85) : Colors.white,),

                      ],
                    ),
                    Text("丨",style: TextStyle(color: MyColors.backgreyColor),),
                    Column(
                      children: [
                        TextButton(onPressed: (){
                          setState(() {
                            isCheck=1;
                          });
                        },
                          child:  Row(
                            children: [
                              Text("已处理",style: TextStyle (fontWeight:isCheck==1? FontWeight.w600:FontWeight.w300,color:Colors.black,fontSize: isCheck==0?14.sp:12.sp),),

                            ],
                          ),
                        ),
                        Container(height: 2.h,width: 27.w,color:isCheck==1?Color.fromRGBO(231, 112, 27, 0.85) : Colors.white,),

                      ],
                    ),
                    SizedBox(),
                  ],
                ),
              ],
            ),
          ),
          SizedBox(height: 10.h,),
          Container(
            height: titleList.length*68.h,
            child: ListView.builder(

              physics: NeverScrollableScrollPhysics(),
              itemCount: titleList.length,
              itemBuilder: (BuildContext context, int index) {
                return Column(
                  children: [
                    Container(
                      color: Colors.white,
                      height: 60.h,
                      padding: EdgeInsets.all(10.w),
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Text(titleList[index],style: TextStyle(color: Colors.black),),
                              Text("2023-06-08  14:15",style: TextStyle(color: MyColors.textColor,fontSize: 12.sp),),
                            ],
                          ),
                          SizedBox(height: 8.h,),
                          Text("科营路二号",style: TextStyle(color: MyColors.textColor,fontSize: 12.sp),),
                        ],
                      ),
                    ),
                    SizedBox(height: 8.h,),
                  ],
                );
              }
            ),
          )
        ],
      ),
    );
  }
}
